package com.hellpro.lolbox.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Package_Name: com.hellpro.lolbox.db
 * Description :
 * author: HellPermanent
 * date:  2016/10/23 17:30
 * remarks：
 */
public class DBHelper extends SQLiteOpenHelper {
    public static  final  String DB_NAME = "lolinfo.db";
    public  static  final  int DB_VERSION = 2;

    public DBHelper(Context context) {
        super(context, DB_NAME,null,DB_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String sql ="CREATE TABLE IF NOT EXISTS colloct_infro(_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,name CHAR(20),qu CHAR(20),jsonobject CHAR(50) )";
     db.execSQL(sql);
        String hero="CREATE TABLE IF NOT EXISTS hero_all(_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,enName CHAR(20),cnName CHAR(20),title CHAR(20),tags CHAR(20),location CHAR(20),location1 CHAR(20),location2 CHAR(20),price CHAR(20) )";
  db.execSQL(hero);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL("DROP TABLE IF EXISTS colloct_infro");
        db.execSQL("DROP TABLE IF EXISTS hero_all");
        onCreate(db);
    }
}
